Type.registerNamespace('ScottCate');

//class holds data, and all methods (once for each class)
ScottCate.LargeMemoryClass = function() {
    this._fName = "Scott";
    this._lName = "Cate";
    this._email = "scott.cate@myKB.com"
    
    this.set_fName = function(value) { this._fName = value; }
    this.get_fName = function() { return this._fName; }
    
    this.set_lName = function(value) { this._lName = value; }
    this.get_lName = function() { return this._lName; }
    
    this.set_email = function(value) { this._email = value; }
    this.get_email = function() { return this._email; }
}

//class holds data, and is prototyped (once) with the methods
ScottCate.SmallMemoryClass = function () {
    this._fName = "Scott";
    this._lName = "Cate";
    this._email = "scott.cate@myKB.com";
}

ScottCate.SmallMemoryClass.prototype = {
    set_fName: function(value) { this._fName = value; },
    get_fName: function() { return this._fName; },
    
    set_lName: function(value) { this._lName = value; },
    get_lName: function() { return this._lName; },
    
    set_email: function(value) { this._email = value; },
    get_email: function() { return this._email; }
}

ScottCate.LargeMemoryClass.registerClass('ScottCate.LargeMemoryClass');
ScottCate.SmallMemoryClass.registerClass('ScottCate.SmallMemoryClass');

var startTime;
var endTime;
var sb;

function LoadClasses(amount, item) {
    WriteToResults('');
    var tank = new Array(amount);
    startTime = new Date().getTime();
    for(x=0;x<amount;x++) {
        tank[x] = new item();
    }
    WriteTankToTable(tank);
}

function WriteTankToTable(tank) {
    
    var sbBody = new Sys.StringBuilder('<table border=1>');
    for(x=0;x<tank.length;x++) {
        sbBody.append('<tr>');
        sbBody.append('<td>' + x + '</td>');
        sbBody.append('<td>' + tank[x].get_fName() + '</td>');
        sbBody.append('<td>' + tank[x].get_lName() + '</td>');
        sbBody.append('<td>' + tank[x].get_email() + '</td>');
        sbBody.append('</tr>');
    }
    sbBody.append('</table>');
    
    endTime = new Date().getTime();
    
    sb = new Sys.StringBuilder('Start : ' + startTime);
    sb.append('<br />');
    sb.append('End : ' + endTime);
    sb.append('<br />');
    sb.append('Total : ' + (endTime - startTime));
    sb.append('<br />');
    sb.append('Loaded : ' + tank.length + ' ' + Object.getTypeName(tank[0]) );
    sb.append('<hr />');

    sb.append( sbBody.toString() );

    WriteToResults( sb.toString() );
    tank = null;
}

function WriteToResults(value) {
    var results = $get('results');
    results.innerHTML = value;
}







